<cfset isAdmin = "1">

<cfset hashedPassword = Hash(#password#,"MD5")>

<cfquery name="attemptLogin" datasource="#fSDS#">

	SELECT * FROM editors
	WHERE `password` = '#hashedPassword#'

</cfquery>

<cfoutput query="attemptLogin">
	
	<cfset isAdmin = '#administrator#'>

</cfoutput>

<cfif isAdmin is "1">

	<cfset roles = "administrator,editor">
    
<cfelse>

	<cfset roles = "editor">
    
</cfif>

<cfif isAdmin is not "">

	<cflogin>
    
    	<cfloginuser name="#username#" password="#password#" roles="#roles#" />
        
    </cflogin>
        

</cfif>

<cflocation url="../default.cfm">